package talk.View;

import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.bumptech.glide.Priority;
import com.bumptech.glide.request.RequestOptions;
import com.facebook.drawee.view.SimpleDraweeView;

import base.BaseActivity;
import talk.Bean.Blank;
import talk.Bean.MyUser;
import talk.Data.Constant;

import com.talk.debby.talk.R;

import talk.activity.HomeActivity;
import talk.activity.MainActivity;
import talk.listener.BlankListener;

public class DrawerViewBuild implements View.OnClickListener {

    private HomeActivity activity;

    private TextView user_id;
    private TextView user_name;
    private SimpleDraweeView simpleDraweeView;
    private TextView tv_log_out;

    public DrawerViewBuild(HomeActivity activity) {
        this.activity = activity;
        initView();
    }

    private void initView() {
        user_id = activity.findViewById(R.id.user_id);
        user_name = activity.findViewById(R.id.user_name);

        activity.findViewById(R.id.tv_log_out).setOnClickListener(this);

        MyUser myUser = activity.getUser();
        if (myUser == null) return;
        MyUser.SinfoBean user = myUser.getSinfo();
        user_id.setText("用户id: " + user.getUid());
        user_name.setText(user.getUname());

        simpleDraweeView = activity.findViewById(R.id.sd_portrait);
        simpleDraweeView.setImageURI(user.getImgurl());
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_log_out:
                Intent intent = new Intent(activity, MainActivity.class);
                activity.startActivity(intent);
                break;
        }

    }

}
